
import request from "../utils/request";
type API<T = any> = (...args: T[]) => Promise<any>
// 获取用户数据
export const getUserApi = (query:any) => {
    return request("/user", {
        method: "get",
        query,
    })
}
// 修改密码
export const userChangePasswordApi = (body: any) => {
    return request(`/user/password`, {
        method: 'PUT',
        body
    })
}
// 验证密码
export const userCheckPasswordApi = (body: any) => {
    return request(`/user/password/check`, {
        query: {
            password: body.password,
            username: body.username
        }
    })
}
//获取部门数据
export const getDeptApi = () => {
    return request('/dept', {
        method:'get'
    })
}
//删除用户
export const delUserApi: API = (userId:any) => {
    return request(`/user/${userId}`, {
        method:'delete'
    })
}
//重置密码
export const restPswApi= (body:any) => {
    return request('/user/password/reset',
        {
            method: 'put',
            body
    })
}
//添加用户
export const addUserApi = (body: any) => {
    return request('/user', {
        method: 'post',
        body
    })
}
//修改用户
export const UpdateUserApi = (body: any) => {
    return request('/user', {
        method: 'put',
        body
    })
}
//修改用户头像
export const UpdateUserAvatarApi = (body: any) => {
    return request('/user/avatar', {
        method: 'put',
        body
    })
}
//修改用户资料
export const UpdateUserInfoApi = (body: any) => {
    return request('/user/profile', {
        method: 'put',
        body
    })
}